home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
476-500
/
disk_497
/
nlcalc
/
calc.doc
< prev
next >
Wrap
Text File
|
1992-05-06
|
12KB
|
268 lines
OVERVIEW:
Calc is a simple calculator program that turns your keypad into a calculator.
Unlike the calculator on the Workbench disk, however, this calculator can
appear on any screen where you may need it. Also, Calc does not open its
window right away. It waits in the background for you to press the F1 key
(or any key that you specify), and then opens its window. This way, it's
there when you want it, and only when you want it.
HOW TO START CALC:
You should place Calc in your C: directory (or in your current path), and
Calc-Handler should be put in the L: directory (or in the current directory).
To start Calc, simply type Calc at the CLI prompt:
1> Calc
You do not need to RUN Calc, since Calc loads the handler code separately,
sets up the handler, and then exits. To remove the Calc handler, simply
issue the Calc command a second time. Calc takes about 15.5 K of memory
while it is installed and dormant.
You can make Calc part of your standard working environment by adding
the "CALC" command (or "CALC > NIL:") to the startup-sequence file in the
S: directory on your boot disk.
HOW TO USE CALC:
Calc does not actually open its window until you ask it to, so when you start
Calc, nothing will seem to happen (except Calc's startup message will appear).
In order to tell Calc that you are ready to use the calculator, press the F1
key. This signals Calc to open its calulator window on the currently active
screen. (You may change the key that brings up the calculator, see CHANGING
THE ACTIVATION KEY, below).
Calc can open on any type of screen except a HAM screen (it will still open,
but it may look very strange). It will appear flattened on interlaced or
lo-res screens. Calc uses the colors of the screen where it opens, so there
should be some contrast in the colors in order to make it possible to see the
legends on the keypad.
Calc now sports the New Look, a method of designing gadgets and imagery that
make them look 3-dimensional. This should make Calc look more solid and
real than previous versions of Calc, but this effect can be lost if the screen
colors are not set up properly. The colors you choose should satisfy the
following conditions: color 0 (the background color) should be a medium dark
color; color 1 (the usual text and menu-bar color) should be the lightest
color; color 2 (used in the depth gadgets) should be a medium bright color;
and color 3 (the CLI cursor color) should be the darkest color (notice that
the relationship of colors 2 and 3 are reversed from the default Intuition
settings; this has the advantage of making the keys appear correctly even
on one-bit-plane screens). You should use the Palette Tool or Preferences
to experiment until you find a color-scheme that suits your taste, but that
still gives the 3D effect. A reasonable grey-scale setup would have
Palette-Tool values 454 FFC 997 000. (Monitors differ, so these values may
need to be adjusted to suit your monitor and lighting conditions). More
colorful combinations also are possible. (For more complete information on
the New Look, see the documentation for the NL-Daemon, which is a program
that implements the New Look for standard Intuition windows and gadgets.)
You can move the Calc window via its drag bar and its front and back gadgets.
When you are done using the calculator for the moment, you can click its
close gadget. This causes the calculator to be closed temporarily, but if
you press the activation key (usually F1) again, it will appear again where
you left it, with all pending operations still active. You can pick up right
where you left off.
You can use the button gadgets on the screen to enter numbers and operations,
or you can use the numeric keypad. The keys should correspond to those
pictured on the screen, that is, pressing numbers on the keypad is equivalent
to clicking on the number gadgets; pressing '+' on the keypad is the same as
clicking on the plus gadget, etc. When you press a key on the keypad, its
corresponding screen images will invert to indicate which key has been pressed.
There are five functions that do not appear on the keypad. These are the sign
change, square root, percent, clear all, and cancel entry keys. The
keyboard equivalents of these are:
Function Keyboard Equivalent
-------- -------- ----------
+/- \ key
root ` key
% % key (shift 5)
C DEL key
CE BackSpace key
= Return or ENTER key
The numeric keys on the main keyboard also activate the calculator keys,
as do the +,-,*,/,(,) and . keys. Note that the CE function does not have a
keyboard representation on the screen. Instead, clicking in the display
area activates this function.
Functions are performed in the correct order of precedence, so if you type
1 + 2 * 3 =
Calc will correctly respond with 7, since 1 + 6 = 7. You can change the
order of operations by using the parenthesis keys. For example:
2 * (1 + 3) =
will display the answer 8. Up to twenty pending operations can be
stored at once this way.
THE CALC DISPLAY:
The Calc display can show up to 13 characters of data, but it does not
handle scientific notation, so the range of numbers is limited to 13 digits,
although internal storage can sometimes exceed this limit. Attempts to use
numbers larger than this will result in an overflow error.
As a visual aid, when you are entering a new number, the display will not
show a decimal point until you actually press it. That is, as you enter an
integer value, no decimal is displayed. This way, if a decimal is showing
(and the value is an integer), you can tell whether you are in the middle of
entering a number or not.
If you attempt to close the screen while Calc is still open on the screen,
Calc will detect the screen close and will close itself automatically. This
makes Calc safe to use on other screens, even if you forget to close it
before exiting from the application owning the screen.
CHANGING THE ACTIVATION KEY:
If you want to use a function key other than F1 to call up the calculator,
simply include the function key name as a parameter to the Calc command.
For instance,
1> Calc F10
Will cause Calc to use the F10 key in place of the F1 key as its activation
key. Any of the function keys can be specified in this way. If you want to
use a key other than a function key, you must specify its HEX keycode (these
are listed in the AmigaDOS Developer's Manual). For example, on an Amiga 1000,
1> Calc 0x45
would tell Calc to use the ESC key to call up a calculator.
If your function keys normally have other functions bound to them, you may
want to specify that certain qualifier keys must be held down at the same
time the activation key is pressed before Calc will open on a new screen
(qualifier keys are the shift, Alt, Amiga, Control and CapsLock keys).
To specify the left-hand shift key together with function key 10 as the
activation sequence for Calc, issue the command:
1> Calc LSHIFT F10
If you specify more than one qualifier key, then they ALL must be held
simultaneously (together with the specified activation key) in order to
activate Calc.
Qualifier keys are especially useful if you want to use a non-Fkey as the
activation key. For instance, Calc LAMIGA C would use left-amiga C as the
activation sequence, while Calc RALT 0x43 would use the right-alt together
with the keypad ENTER key as the activation sequence.
The names for the qualifier keys are:
LSHIFT Left Shift Key
RSHIFT Right Shift Key
CAPSLOCK The Caps Lock Key
CONTROL The Control Key
LALT The Left ALT Key
RALT The Right ALT Key
LAMIGA The Left Amiga Key
RAMIGA The Right Amiga Key
SHIFT,ALT, and AMIGA refer to the LEFT key of each type
LCOMMAND,RCOMMAND are synonyms for LAMIGA and RAMIGA
USING CALC WITH SWINDOWS AND NL-DAEMON:
Calc can take advantage of sWindows and NL-Daemon if you wish. Normally,
Calc includes the code to handle the functions of both of these utilities
so that you can run Calc independent of them. You may wish to take advantage
of these utilities and save a little space. If so, you can recompile Calc
using flags -dSWINDOWS and -dNL_DAEMON (either or both) to remove the
unnecessary code from Calc (you can save about 1K this way).
Calc should function exactly the same (provided you have sWindows and
NL-Daemon running) with one minor change. If you attempt to close the screen
where Calc is currently open, the screen will remain open until you close
Calc, then the screen will close (this is a feature of sWindows). Normally,
Calc would detect the screen closing and close itself quietly until you
pressed the activation key again.
Compiling with the -dSWINDOWS flag removes the code from Calc that handles
opening the Calc window on the active screen (sWindows will do this for you).
Using Calc compiled with this flag but without having sWindows running will
mean that Calc will only open on the Workbench screen.
Compiling with the -dNL_DAEMON flag removes the code from Calc that adds
the New Look imagery to the Intuition gadgets (NL-Daemon does this for you).
Using Calc compiled with this flag but without having NL-Daemon running will
mean that Calc will have standard Intuition depth, close and drag bars. The
Calc gadgets themselves are not affected.
CHANGES FROM VERSION 2:
Version 3 now comes as two separate components: the loader and the handler.
This reduces the memory requirements as the start-up and clean-up portions
of the code are not kept in memory all the time.
A consequence is that you no longer have to RUN Calc. Instead, Calc now
loads the handler code, and then exits, leaving the handler in memory.
Another consequence of this is that CTRL-C no longer will cause Calc to
remove itself from the system. Instead, you must explicitly call Calc a
second time so that it can remove the handler and clean up for it.
Calc now lets you specify which key and qualifiers are used to call up
the calculator window.
Calc now sports the New Look and requires more care in the choice of screen
colors (see HOW TO USE CALC above).
Calc can take advantage of the sWindows and NL-Daemon utilities (via
compile-time options that remove similar code from Calc).
The display code for Calc has been re-written to save about 4K of memory.
COMPILING CALC:
Calc was developed using the Lattice C compiler v4.0 on a 512K
Amiga 1000. It probably will need to be modified to work with the
Manx Aztec C compiler. To compile and link Calc, use the following
commands (these appear in Calc.com, distributed with the source code):
1> lc -v -b0 -M cMain cSetup cFunc cKeys cHandler cLoader
1> lc -v -b0 -M -ad cImage
1> asm cStubs
1> asm c
1> blink with cHandler.lnk
1> blink with cLoader.lnk
The -v -b0 and -ad options are required. The -M is to compile only those
source files that have been updated since the last compile.
To compile Calc so that it takes advantage of sWindows and NL-Daemon,
use the following commands (which are in SmallCalc.com):
1> lc -v -b0 -M -dSWINDOWS -dNL_DAEMON cMain cSetup cFunc cKeys
1> lc -v -b0 -M -dSWINDOWS -dNL_DAEMON cHandler cLoader
1> asm cSmallStubs
1> asm c
1> blink with cSmallHandler.lnk
1> blink with cLoader.lnk
AUTHOR:
Calc and Calc-Handler
Copyright (c) 1989 by Davide P. Cervone, all rights reserved.
Davide P. Cervone
Department of Mathematics, Box 1917 ST402523@BROWNVM.BITNET
Brown University st402523@brownvm.brown.edu
Providence, Rhode Island 02912 dpvc@fermat.math.brown.edu